
const bar = () => console.log('bar')

const baz = () => console.log('baz')

const foo = () => {
  console.log('foo')
  setImmediate(() => {
    //运行一些东西
    console.log("Immediate");
  })
  setTimeout(bar, 0)
  new Promise((resolve, reject) =>
    resolve('应该在 baz 之后、bar 之前')
  )
  .then(resolve => {
    console.log(resolve)
  })
  baz()
}

foo()

process.nextTick(() => {
  //做些事情
  console.log("nextTick")
})